<%@ page language="java" contentType="application/vnd.ms-excel; charset=UTF-8"
    pageEncoding="UTF-8" import="com.java.service.*,java.util.*,com.java.model.UserSession,com.java.util.*"%>
<%
response.setHeader("Content-Disposition", "inline; filename=sugang.xls"); // 파일 이름 지정
response.setHeader("Content-Description", "JSP Generated Data");
%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Excel Download</title>
</head>
<%
	request.setCharacterEncoding("utf-8"); 
	UserSession usersession = (UserSession)session.getAttribute("user");
	
	String connGroup 	= "";
	String user_id 		= "";
	if(usersession!=null){
		connGroup 	= CmmUtil.nvl(usersession.getConnGroup(),"0");
		user_id 	= CmmUtil.nvl(usersession.getUser_id(),"");
	}
	String keyword_gb 	= CmmUtil.nvl(request.getParameter("search_gb"),"");
	String keyword 		= CmmUtil.nvl(request.getParameter("search_word"),"");
	
	System.out.println("keyword  " + keyword);
	
	String total_count = CmmUtil.nvl(request.getParameter("total_count"),"0");
 	
 	if(keyword_gb.equals("3")){
 		keyword = Crypto.EncodeBySType(keyword);
 	}
 	
	HashMap map = new HashMap();
	HashMap map1 = null;
	ArrayList list = new ArrayList();
	CommonDaoService commonservice = new CommonDaoService("Com0102lp01Dao");
	map.put("connGroup",connGroup);
	map.put("user_id",user_id);
	map.put("search_combo",keyword_gb);
	map.put("keyword",keyword);
	map.put("page_row",total_count);
	map.put("total_row","0");
	map.put("page_no","0");

	
	list = (ArrayList)commonservice.commonDaoMethod(map);
	
	
	//리스트에 뿌릴 사용자 정보
	String poi_nm 			="";
	String login_nm			="";
	String std_app_dt 		="";
	String app_dt 			="";
	String std_status		="";
	String repl_dt			="";
	
	
%>
<body>
<form name="excel_frm">
<b></b>
</BR>
</BR>
<table width="760" border="1" cellpadding="2" cellspacing="0" bordercolor="C0C0C0" bordercolordark="#FFFFFF" frame=below >
	<tr height="23">
		<td width="170" bgcolor="#D3EBD7" align="center"> 과정 </td>
	    <td width="50" bgcolor="#D3EBD7" align="center"> 아이디 </td>
	    <td width="145" bgcolor="#D3EBD7" align="center"> 수강기간 </td>
	    <td width="65" bgcolor="#D3EBD7" align="center"> 신청일자 </td>
	    <td width="20" bgcolor="#D3EBD7" align="center"> 상태 </td>
	    <td width="145" bgcolor="#D3EBD7" align="center"> 비고 </td>
	</tr>
	<% for (int i=0; i< list.size(); i++) {
		map1 = (HashMap)list.get(i);
		poi_nm 			= CmmUtil.nvl((String)map1.get("poi_nm") ,"");
		login_nm		= CmmUtil.nvl((String)map1.get("login_nm") ,"");
		std_app_dt 		= CmmUtil.nvl((String)map1.get("std_app_dt"),"");
		app_dt			= CmmUtil.nvl((String)map1.get("app_dt") ,"");
		std_status		= CmmUtil.nvl((String)map1.get("std_status") ,"");
		repl_dt			= CmmUtil.nvl((String)map1.get("std_status") ,"");
	%>
	<tr height="23">
		<td width="170" align="center"> <%= poi_nm %> </td>
	    <td width="50" align="center"> <%= login_nm %> </td>
	    <td width="145" align="center"> <%= std_app_dt %> </td>
	    <td width="65" align="center"> <%= app_dt %> </td>
	    <td width="20" align="center"> <%= std_status %> </td>
	    <td width="145" align="center"> <%= repl_dt %> </td>
	</tr>
	<% }%>
</table>
</form>
</body>
</html>